package de.openkanban.client.ui.presenter;

import com.google.gwt.http.client.Request;
import com.google.gwt.http.client.RequestCallback;
import com.google.gwt.http.client.Response;

import de.openkanban.client.ui.adminpanel.UserAccountForm;
import de.openkanban.shared.dto.StatusDto;

public class UpdateUserAccountRequestCallback implements RequestCallback {

	private UserAccountForm view;

	public UpdateUserAccountRequestCallback(UserAccountForm userAccountForm) {
		this.view = userAccountForm;
	}

	@Override
	public void onResponseReceived(Request request, Response response) {
		StatusDto status = new StatusDto(response.getText());
		if (status.isCallSuccessfull()) {
			view.showSuccessMessage();
		} else {
			view.showFailureMessage();
		}
	}

	@Override
	public void onError(Request request, Throwable exception) {

	}

}
